/*
 * @lc app=leetcode.cn id=1189 lang=typescript
 *
 * [1189] “气球” 的最大数量
 */

// @lc code=start
function maxNumberOfBalloons(text: string): number {
    let list = {
        b: 0,
        a: 0,
        l: 0,
        o: 0,
        n: 0,
    };
    for (const iterator of text) {
        if (iterator in list) {
            /* @ts-ignore */
            list[iterator]++;
        }
    }
    return Math.min(
        list.a,
        list.b,
        Math.floor(list.l / 2),
        Math.floor(list.o / 2),
        list.n
    );
}
// @lc code=end
